package com.des1gn.ymgetil.util;

import cn.hutool.core.codec.Base64;
import cn.hutool.jwt.JWTUtil;
import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;

import javax.crypto.BadPaddingException;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import java.io.UnsupportedEncodingException;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;

/**
 * @ClassName Test
 * @Description TODO
 * @Author Des1gn
 * @Date 2021/11/24 13:51
 * @Version 1.0
 **/
public class Test {

    public static void main(String[] args) throws UnsupportedEncodingException, NoSuchPaddingException, NoSuchAlgorithmException, InvalidAlgorithmParameterException, InvalidKeyException, BadPaddingException, IllegalBlockSizeException {

//        String sessionId = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2Mzc3NjU5ODcuNTgyMTk3MiwiZXhwIjoxNjM3NzY5NTg3LjU4MjE5NzIsInN1YiI6IllOVy5WSVAiLCJqdGkiOiIyMDIxMTEyNDEwNTk0NyIsInZhbCI6Ik9Wb0dBUUlBQUFBUU1qZzROakJoWkRabE1URmlObVU1TVJ4dmNYSTFielZKU0hScmVIQTJSVVpXWmtWWU1Wa3RTWGMzYjJOSkFCeHZcclxuVlRJMldIUXRVaTEyUTNKa05ERlZhMWxzYmkxblFWZ3lUekJ2RHpFeE1DNHhPVEV1TWpRekxqRXhOd0FBQUFBQUFBQT0ifQ.pkFH-Qv6G0JxAyA2VZoO3O-9O0tr67UwA07d0MpF8hM";
//        String a = "E3B13618359634DC7F6ADCDA4EBF777818222C77FA634B650208BDB02E28F820659C42C034565083E1F68645B95C1E5D368DB430F6D9C3A577541270AAD522AFA852DDB0341EA5AD3D4B28EEE2BE80C2639A44A43B52BC7069F3FA36D89598569C0529FA4580E87A86CF6A9A31C39834D1CCE646143910756BBA020AEC4F8DB4A36E7BB5C10D6A886216487D8F26C3CDCE7657BADF1E5B66964C25B1B1D1C72774EF7AB0D8D332745FCEC3E5059E129D36B650443F47AA25EF7606628B88911DB47C714B13A9146D9AC666DDCE6B270B2C4D3ECFD2395B1A6F29988E96BB907C6713D48A9D2718174BF6627B9E5B98943C0929C99FD9032A43F29D521E46C79C2F3673AF10839BE95197429D4F14735FC622FCAED3D88DFA44A660565991DDA799E1D2A964A56118EB9205FFC7F401F082D97AF980FE6D1E446F7EF9543A8ABBE3400EE632A6B94EC27A65E43C0450A98C21357B2F28A2C8FD38BEE7614F51F57CBB80BDDD917A9DFF105F27E5E7F4225B8A4590A7331926246C0A9A4A97069C18C00E74F0DFC272DAA94A965857E016733390C56A9850FF5EE1469E16DAF2F4";
//        String s = AesUtil.decoderAes(a, sessionId);
//        System.out.println(s);
//        DateTime dateTime = new DateTime(1637769587L);
//        System.out.println(DateTimeFormat.forPattern("yyyyMMddHHmmss").parseDateTime("20211124105947").plusMillis(1637769587).toString("yyyyMMddHHmmss"));

//        String d = Base64.decodeStr("VTI2WHQtUi12Q3JkNDFVa1lsbi1nQVgyTzBvDzExMC4xOTEuMjQzLjExNwAQT1ZvR0FlLVRBQUMyWlRRQgEAAAAA");
//        String c = Base64.decodeStr("VTI2WHQtUi12Q3JkNDFVa1lsbi1nQVgyTzBvDzExMC4xOTEuMjQzLjExNwAAAAAAAAA=");
//        System.out.println(d.replaceAll(" ",""));
//        System.out.println(c.replaceAll(" ",""));
//        System.out.println(Base64.decodeStr("VTI2WHQtUi12Q3JkNDFVa1lsbi1nQVgyTzBvDzExMC4xOTEuMjQzLjExNwAAAAAAAAA=".replaceAll("A","").replaceAll("=","")));
//        String u = "U26Xt-R-vCrd41UkYln-gAX2O0o\u000F110.191.243.117       ";
//        System.out.println(Base64.encode("U26Xt-R-vCrd41UkYln-gAX2O0o\u000F110.191.243.117 \u0010OVoGAe-TAAC2ZTQB\u0001"));
//        System.out.println(Base64.encode("U26Xt-R-vCrd41UkYln-gAX2O0o\u000F110.191.243.117 "));


        JwtUtil.getNewSessionId("eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2Mzc4NTIxMDEuMjYxNTIwNCwiZXhwIjoxNjM3ODU1NzAxLjI2MTUyMDQsInN1YiI6IllOVy5WSVAiLCJqdGkiOiIyMDIxMTEyNTEwNTUwMSIsInZhbCI6Ik9Wb0dBUUlBQUFBUVpqUTNZVEUxT1RNNE4yVm1ObU5pTkJ4dmNYSTFielZKU0hScmVIQTJSVVpXWmtWWU1Wa3RTWGMzYjJOSkFCeHZcclxuVlRJMldIUXRVaTEyUTNKa05ERlZhMWxzYmkxblFWZ3lUekJ2RHpFeE1DNHhPVEV1TWpRekxqRXhOd0FBQUFBQUFBQT0ifQ.9AHvYkDrXIljxmgnXpj4UL7IIsV35CyAZZElwctz73A","OVoGAe-TAAC2ZTQB");

    }

}
